function promiseWithTimeout(promise,delay) {
    return new Promise((resolve, reject) => {
        setTimeout(() => {
            reject('timeout')
        }, delay)
        Promise.resolve(promise).then(response => {
            resolve(response)
        }).catch(error => {
            reject(error)
        })
    })
}